package com.telit.android.controller;

import com.telit.android.service.IAppTaskService;
import com.telit.common.entity.DataReturn;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;


/**
 * @Auther amy
 * @Describe app端个人任务控制层
 */
@RestController
@RequestMapping("/app")
public class AppPersonTaskController {

    @Autowired
    private IAppTaskService appTaskService;

//    @Autowired
//    private UserInfoService userInfoService;
//
//    @Autowired
//    private ForestInfoService forestInfoService;

//    @Autowired
//    private RemoteFirecommandService remoteFirecommandService;

    @GetMapping(value = "/unFinishTaskDetail/{id}/{forestkeeperId}", produces = "application/json;charset=UTF-8")
    @ApiOperation("app端-护林员任务详情")
    public DataReturn appPatrolTaskDetail(@PathVariable("forestkeeperId") Long forestkeeperId,
                                          @PathVariable("id") Long id) {
        return DataReturn.ok(appTaskService.unFinishPatrolDetailById(forestkeeperId, id));
    }

//    @GetMapping(value = "/detail",produces = "application/json;charset=UTF-8")
//    @ApiOperation("用户信息")
//    public DataReturn userInfo(@RequestParam(value = "id") Long id){
//        SysUserDetailVo vo = userInfoService.getUserInfo(id);
//        if(vo == null){
//            return DataReturn.failure(ResultCode.OPERATE_ERROR.getCode(),"该用户不存在");
//        }
//
//        // 处理头像图片
//        if (StringUtils.isNotBlank(vo.getIcon())) {
//            List<String> picList = JSON.parseArray(vo.getIcon(), String.class);
//            if (!CollectionUtils.isEmpty(picList)) {
//                //TODO:v1.1.0 预览图片
////                vo.setIcon(MinioUtils.previewImg(picList.get(0)));
//            }
//        }
//        return DataReturn.ok(vo);
//    }

//    @GetMapping(value = "/allUser", produces = "application/json;charset=UTF-8")
//    @ApiOperation("获取所有用户列表/通讯录使用")
//    public DataReturn getUserList(SysUserPageDto sysUserPageDto) {
//        List<SysUserShortVo> list = userInfoService.getAllUser(sysUserPageDto);
////        if(!CollectionUtils.isEmpty(list)){
////            list.forEach(user->{
////                if(StringUtils.isNotBlank(user.getIcon())){
////                    List<String> picList = JSON.parseArray(user.getIcon(),String.class);
////                    if(!CollectionUtils.isEmpty(picList)){
////                        user.setIcon(MinioUtils.previewImg(picList.get(0)));
////                    }
////                }
////            });
////        }
//        return DataReturn.ok(list);
//    }

//    @GetMapping(value = "/forestCount", produces = "application/json;charset=UTF-8")
//    @ApiOperation("获取护林员数量比例")
//    public DataReturn getForestCount() {
//        Map<String, Integer> resultMap = new HashMap<>();
//        DataReturn dataReturn = remoteFirecommandService.countForesterByCondition(
//                null, null);
//        if (!ResultCode.SUCCESS.getCode().equals(dataReturn.getCode())) {
//            throw new ForestBaseException(dataReturn.getErrorMsg());
//        }
//        Map map = JSON.parseObject(JSON.toJSONString(dataReturn.getData()), Map.class);
//        resultMap.put("forestCountTotal", MapUtil.getInt(map, "count"));
//        resultMap.put("onlineCount", MapUtil.getInt(map, "onlineCount"));
//        return DataReturn.ok(resultMap);
//    }

//    @GetMapping(value = "/forestUserInfo",produces = "application/json;charset=UTF-8")
//    @ApiOperation("查询护林员信息")
//    public DataReturn getForestPage(
//            @RequestParam(value = "regionCode",required = false)String regionCode,
//            @RequestParam(value = "name",required = false)String name,
//            @RequestParam(value = "status",required = false)Integer status){
//        return DataReturn.ok(forestInfoService.listForestPage(regionCode,name,status));
//    }

}
